﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using jQuery.Validation.Web.Models;

namespace jQuery.Validation.Web.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Confirmation()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC!";

            return View();
        }

        [HttpGet]
        public ActionResult Register()
        {
            Registration registration = new Registration();
            return View(registration);
        }

        [HttpPost]
        public ActionResult Register(Registration registration)
        {
            if (!ModelState.IsValid)
                return View(registration);

            ViewData["Message"] = "Model is Valid";

            return View("Confirmation");
        }
    }
}
